package org.springblade.modules.admin.controller.suger;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springblade.modules.admin.dto.sugar.SugarSearchDTO;
import org.springblade.modules.admin.entity.Building;
import org.springblade.modules.admin.entity.MaintainMalfunctionWork;
import org.springblade.modules.admin.service.BuildingService;
import org.springblade.modules.admin.service.IMaintainMalfunctionWorkService;
import org.springblade.modules.admin.service.MaintainPartsWorkService;
import org.springblade.modules.admin.vo.sugar.map.BuildingMapVo;
import org.springblade.modules.admin.vo.sugar.map.SugarMapEleBuildVo;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zcc
 * @version 1.0
 * @date 2023/10/20 9:28
 */
@RestController
@RequestMapping("/admin/sugar/malfunction/map")
@AllArgsConstructor
@Api(value = "数据大屏维修管理", tags = "数据大屏维修管理")
public class SugarMalfunctionMapController {

	private final BuildingService buildingService;


	private final IMaintainMalfunctionWorkService malfunctionWorkService;

	/**
	 * 地图的项目电梯信息
	 *
	 * @return
	 */
	@PostMapping("getSugarMapEleBuildInfo")
	@ApiOperation("维修-地图的项目电梯信息")
	public R<SugarMapEleBuildVo> getSugarMapEleBuildInfo(@RequestBody SugarSearchDTO searchDTO) {
		SugarMapEleBuildVo sugarMapEleBuildInfo = buildingService.getSugarMapEleBuildInfo(searchDTO);
		return R.data(sugarMapEleBuildInfo);
	}

	@PostMapping("getBuildingListOfPlan")
	@ApiOperation("维修-地图的维修工单项目列表")
	public R<List<Building>> getBuildingListOfPlan(@RequestBody SugarSearchDTO searchDTO) {

		List<Building> list = malfunctionWorkService.getBuildingListOfPlan(searchDTO);
		return R.data(list);
	}


	@PostMapping("getBuildingMapInfo")
	@ApiOperation("维修-地图项目下工单明细")
	public R<BuildingMapVo> getBuildingMapInfo(@RequestBody SugarSearchDTO searchDTO) {
		BuildingMapVo buildingMapInfo = malfunctionWorkService.getBuildingMapInfo(searchDTO);
		return R.data(buildingMapInfo);
	}
}
